﻿<%@ WebHandler Language="C#" Class="HandlerConfigGame" %>

using System;
using System.Web;
using System.Web.SessionState;
using HighLowGameBLL;

public class HandlerConfigGame : IHttpHandler, IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) {
         string type = context.Request.QueryString["t"] ?? string.Empty;

         switch (type)
         {
             case "GameGetInfo":
                 GameGetInfo(context);
                 break;
         }
    }
    public void GameGetInfo(HttpContext context)
    {
        var ctr = new CtrHiLoGame();
        int gameId = Convert.ToInt32(context.Request.QueryString["gameId"] ?? "-1");
        var info = ctr.SelectGame(gameId);        
        string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(info);
        context.Response.ContentType = "application/json";
        context.Response.Write(jsonString);
    }
    public bool IsReusable {
        get {
            return false;
        }
    }

}